All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.multimedia.ImageMap
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----symantec.itools.multimedia.ImageViewer
|
+----symantec.itools.multimedia.ImageMap
- public class ImageMap
- extends ImageViewer
Creates clickable hot spots over an image. The programmer defines one or more hot spot
rectangles over an image. When the user moves the mouse into a hotspot it
is optionally hilighted. When the user clicks on a hot sopt an action event is generated.
- See Also:
- ImageViewer
-
rects
- List of rectangles in this image map.
-
ImageMap()
- Create default image map.
-
ImageMap(boolean)
- Create image map with optional highlight.
-
ImageMap(boolean, Image)
- Create image map with Image.
-
ImageMap(boolean, String)
- Create image map with filename.
-
ImageMap(boolean, URL)
- Create image map with URL.
-
addRect(ImageMapRect)
- Add a hot spot rectangle to the image map using an ImageMapRect.
-
addRect(int, int, int, int)
- Add a hot spot rectangle to the image map using coordinates.
-
findRect(int, int)
- Determines if a given point is an any of the image map's rectangles.
-
getShowrect()
- Obtain the current hilight mode.
-
mouseDown(Event, int, int)
- Processes MOUSE_DOWN events.
-
mouseMove(Event, int, int)
- Processes MOUSE_MOVE events.
-
mouseUp(Event, int, int)
- Processes MOUSE_UP events.
-
overlap(ImageMapRect)
- Determines if a rectangle overlaps an existing image map rectangle.
-
setShowrect(boolean)
- Change the hilight mode.
rects
protected Vector rects
- List of rectangles in this image map.
ImageMap
public ImageMap()
- Create default image map. The default image map contains no image,
no rectangles,
and is set to show rectangles when the users mouse moves within them.
ImageMap
public ImageMap(boolean showrect)
- Create image map with optional highlight. This constructor allows control
of showrect mode, the mode that shows the map's rectangles when the users mouse
moves within them.
- Parameters:
- showrect - if true the ImageMap will display the map rectangles as the
user's mouse moves over them
ImageMap
public ImageMap(boolean showrect,
String str) throws MalformedURLException
- Create image map with filename. The specified filename is used as the
image source.
- Parameters:
- showrect - if true the ImageMap will display the map rectangles as the
user's mouse moves over them
- str - name of file containing the image source
- Throws: MalformedURLException
- thrown if URL cannot be generated from filename
ImageMap
public ImageMap(boolean showrect,
URL url) throws MalformedURLException
- Create image map with URL. The specified URL is used as the
image source.
- Parameters:
- showrect - if true the ImageMap will display the map rectangles as the
user's mouse moves over them
- url - URL of file containing the image source
- Throws: MalformedURLException
- thrown if the URL syntax is invalid
ImageMap
public ImageMap(boolean showrect,
Image img) throws MalformedURLException
- Create image map with Image. The specified Image is used as the
image source.
- Parameters:
- showrect - if true the ImageMap will display the map rectangles as the
user's mouse moves over them
- img - image to be displayed by this component
setShowrect
public void setShowrect(boolean f)
- Change the hilight mode. The image map can optionally display the map's
rectangles when the user's mouse cursor moves over the rectangle.
- Parameters:
- f - set true to hilight rectangles
getShowrect
public boolean getShowrect()
- Obtain the current hilight mode.
- Returns:
- true if currently hilighting image map rectangles
addRect
public boolean addRect(int x,
int y,
int w,
int h)
- Add a hot spot rectangle to the image map using coordinates.
This rectangle is added to
this list of hot spots for this image map.
- Parameters:
- x - horizontal position of new rectangle
- y - vertical position of the new rectangle
- w - width of the new rectangle
- h - height of the new rectangle
- Returns:
- true if the rectangle was added, false if the rectangle overlaps
another rectangle and was not added
addRect
public boolean addRect(ImageMapRect r)
- Add a hot spot rectangle to the image map using an ImageMapRect.
This rectangle is added to
this list of hot spots for this image map.
- Parameters:
- r - rectangle to be added to the map
- Returns:
- true if the rectangle was added, false if the rectangle overlaps
another rectangle and was not added
findRect
public ImageMapRect findRect(int x,
int y)
- Determines if a given point is an any of the image map's rectangles.
- Parameters:
- x - horizontal location of point to check
- y - vertical location of point to check
- Returns:
- null if the point is not in a rectangle, otherwise returns the rectangle
in which the point was found
overlap
public boolean overlap(ImageMapRect new_r)
- Determines if a rectangle overlaps an existing image map rectangle.
- Parameters:
- new_r - the rectangle to compare to existing list
- Returns:
- true if the rectangle overlaps any existing rectangle in this image map
mouseMove
public boolean mouseMove(Event e,
int x,
int y)
- Processes MOUSE_MOVE events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_MOVE
event. These events occur when the mouse is moved around inside this
component while the button is NOT pressed.
It has been overridden here to hilight the image map rectangles as needed.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- true if the event was handled
- Overrides:
- mouseMove in class Component
- See Also:
- mouseDrag, handleEvent
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- Processes MOUSE_DOWN events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_DOWN
event. These events occur when the mouse button is pressed while
inside this component.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- always true since the event was handled
- Overrides:
- mouseDown in class Component
- See Also:
- mouseUp, handleEvent
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
- Processes MOUSE_UP events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_UP
event. These events occur when the mouse button is released while
inside this component.
If the MOUSE_UP occured in the same
map rectangle that the mouse down occured in, an ACTION_EVENT is generated
and directed to the ImageMapRect in which the event occured.
- Parameters:
- e - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- true if the event was handled
- Overrides:
- mouseUp in class Component
- See Also:
- mouseDown, handleEvent
All Packages Class Hierarchy This Package Previous Next Index